package cn.wolfcode.luowowo.search.service.impl;

import cn.wolfcode.luowowo.search.repository.UserInfoTemplateRepository;
import cn.wolfcode.luowowo.search.service.IUserInfoTemplateService;
import cn.wolfcode.luowowo.search.template.UserInfoTemplate;
import com.alibaba.dubbo.config.annotation.Service;
import org.elasticsearch.client.transport.TransportClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;

import java.util.List;

@Service
public class UserInfoTemplateServiceImpl implements IUserInfoTemplateService {

    @Autowired
    private UserInfoTemplateRepository repository;
    @Autowired
    private ElasticsearchTemplate template;
    @Autowired
    private TransportClient client; //java操作es数据的第三方客户端


    @Override
    public void saveOrUpdate(UserInfoTemplate template) {
        repository.save(template);
    }

    /**
     * 根据目的地名称查询所有用户信息
     * @param destName
     * @return
     */
    @Override
    public List<UserInfoTemplate> findByDestName(String destName) {
        return repository.findByDestName(destName);
    }
}
